package pers.cz.business;

import pers.cz.mapper.AutoHostsDelMapper;
import pers.cz.model.AutoHostsDel;
import pers.cz.model.AutoHostsDelExample;
import pers.cz.pub.AbstractBusiness;

import java.util.List;

/**
 * 热替换
 * @program: PostGirl-panent
 * @description: HotSweapBusiness
 * @author: Cheng Zhi
 * @create: 2021-11-28 16:38
 **/
public class HotSweapBusiness extends AbstractBusiness {

    /**
     * 查询所有的主机信息
     * @return
     */
    public List<AutoHostsDel> queryAllAutoHostsDel() {

        AutoHostsDelExample example = new AutoHostsDelExample();
        AutoHostsDelExample.Criteria criteria = example.createCriteria();
        criteria.andIdIsNotNull();
        List<AutoHostsDel> autoHostsDels = this.getMapper(AutoHostsDelMapper.class).selectByExample(example);

        return autoHostsDels;
    }

    /**
     * 添加主机信息
     * @param autoHostsDel
     * @return
     */
    public Integer addAutoHostsDel(AutoHostsDel autoHostsDel) {

        return this.getMapper(AutoHostsDelMapper.class).insert(autoHostsDel);
    }

    /**
     * 删除主机信息
     * @param id
     * @return
     */
    public Integer deleteAutoHostsDel(Integer id) {

        return this.getMapper(AutoHostsDelMapper.class).deleteByPrimaryKey(id);
    }

    /**
     * 修改主机信息
     * @param autoHostsDel
     * @return
     */
    public Integer updateAutoHostsDel(AutoHostsDel autoHostsDel) {

        return  this.getMapper(AutoHostsDelMapper.class).updateByPrimaryKeySelective(autoHostsDel);
    }
}
